Let xml_parse_time take a QString&.
authorrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 1 Aug 2013 04:02:54 +0000 (04:02 +0000)
committerrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 1 Aug 2013 04:02:54 +0000 (04:02 +0000)
git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4495 f51c46e8-681c-474f-0cfe-069cfd0219fb

gpsbabel/defs.h
gpsbabel/gpx.cc

index b06760428aef36e57bd0674a3f65f4762eef15fe..33529610f104299effa7cb84bc855b428ec9e400 100644 (file)
@@ -1021,7 +1021,7 @@ const char* get_filename(const char* fname);                      /* extract the filename portion *
 #define str_iso8859_1_to_utf8(str) cet_str_iso8859_1_to_utf8((str))
 
 /* this lives in gpx.c */
-gpsbabel::DateTime xml_parse_time(const char* cdatastr);
+gpsbabel::DateTime xml_parse_time(const QString& cdatastr);
 
 xml_tag* xml_findfirst(xml_tag* root, const char* tagname);
 xml_tag* xml_findnext(xml_tag* root, xml_tag* cur, const char* tagname);
index 8eb6cf01c68e38afa223a360be64167511c77c88..daab6eba84bb06dcc87a496534499cb2bae62af0 100644 (file)
@@ -843,14 +843,14 @@ gs_get_container(geocache_container t)
 }
 
 gpsbabel::DateTime
-xml_parse_time(const char* cdatastr)
+xml_parse_time(const QString& dateTimeString)
 {
   int off_hr = 0;
   int off_min = 0;
   int off_sign = 1;
   char* offsetstr = NULL;
   char* pointstr = NULL;
-  char* timestr = xstrdup(cdatastr);
+  char* timestr = xstrdup(dateTimeString.toUtf8().data());
 
   offsetstr = strchr(timestr, 'Z');
   if (offsetstr) {
@@ -905,11 +905,11 @@ xml_parse_time(const char* cdatastr)
     // Any offsets that were stuck at the end.
     time = time.addSecs(-off_sign * off_hr * 3600 - off_sign * off_min * 60);
 
-    xfree(timestr);
     dt = QDateTime(date, time, Qt::UTC);
   } else {
     dt = QDateTime();
   }
+  xfree(timestr);
   return dt;
 }